import com.troyworks.calendar.Calendar;
/**
 * @author Troy Gardner
 */
class com.troyworks.calendar.CalendarDay extends MovieClip{
	public var myDate:Number;
	public var calendar:Calendar;

//UI
	public var day_txt:TextField;
	public var dayButton:Button;
	public var isOver_mc:MovieClip;
	public var isSelected_mc:MovieClip;
	public var isToday_mc:MovieClip;
	public var background_mc:MovieClip;
	
	public function CalendarDay() {
		super();
	}
	public function onLoad():Void{
		trace("CaldendarDay.onLoad()" + myDate);
		day_txt.text = String(myDate);
			isOver_mc._visible = false;
		updateUI();	
	}

	public function updateUI():Void{
		if(calendar.selectedDate.getDate()== myDate){
			isSelected_mc._visible = true;
		}else{
			isSelected_mc._visible = false;
		}
		if( myDate  == calendar.todaysDate.getDate()){
			isToday_mc._visible = true;
		}else{
			isToday_mc._visible = false;
		}
	}
	public function onRollOver():Void{
		isOver_mc._visible = true;
	}
	public function onRollOut():Void{
		isOver_mc._visible = false;
	}
	public function onPress():Void {
		calendar.selectDate(myDate);
	};
}